LanguageExt.Core

LanguageExt.Core Monads State and Environment Monads Reader ReaderT

Contents

record ReaderT <Env, M, A> (Func<Env, K<M, A>> runReader) Source #

where M : Monad<M>, SemiAlternative<M>

ReaderT monad transformer, which adds a static environment to a given monad.

Parameters

type Env

Reader environment type

type M

Given monad trait

type A

Bound value type

param runReader

Transducer that represents the transformer operation

Methods

method ReaderT<Env, M, A> Pure (A value) Source #

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

ReaderT

method ReaderT<Env, M, A> Asks (Func<Env, A> f) Source #

Extracts the environment value and maps it to the bound value

Parameters

param f

Environment mapping function

returns

ReaderT

method ReaderT<Env, M, A> AsksM (Func<Env, K<M, A>> f) Source #

Extracts the environment value and maps it to the bound value

Parameters

param f

Environment mapping function

returns

ReaderT

method ReaderT<Env, M, A> Lift (Pure<A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

ReaderT

method ReaderT<Env, M, A> Lift (K<M, A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

ReaderT

method ReaderT<Env, M, A> Lift (Func<A> f) Source #

Lifts a unit function into the transformer

Parameters

param f

Function to lift

returns

ReaderT

method ReaderT<Env, M, A> LiftIO (IO<A> ma) Source #

Lifts a unit function into the transformer

Parameters

param f

Function to lift

returns

ReaderT

method ReaderT<Env1, M, A> With <Env1> (Func<Env1, Env> f) Source #

Maps the Reader's environment value

Parameters

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, A> Local (Func<Env, Env> f) Source #

Maps the Reader's environment value

Parameters

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M1, B> MapM <M1, B> (Func<K<M, A>, K<M1, B>> f) Source #

where M1 : Monad<M1>, SemiAlternative<M1>

Maps the given monad

Parameters

type M1

Trait of the monad to map to

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, B> Map <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, B> Select <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping transducer

returns

ReaderT

method ReaderT<Env, M, B> Bind <B> (Func<A, K<ReaderT<Env, M>, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, B> Bind <B> (Func<A, ReaderT<Env, M, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, B> Bind <B> (Func<A, Ask<Env, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, B> Bind <B> (Func<A, IO<B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <B, C> (Func<A, K<ReaderT<Env, M>, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <B, C> (Func<A, ReaderT<Env, M, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <B, C> (Func<A, K<M, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <B, C> (Func<A, Ask<Env, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <B, C> (Func<A, IO<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method K<M, A> Run (Env env) Source #

Run the reader monad

Parameters

param env

Input environment

returns

Bound monad

Operators

operator | (ReaderT<Env, M, A> ma, ReaderT<Env, M, A> mb) Source #

operator | (ReaderT<Env, M, A> ma, Pure<A> mb) Source #

operator | (ReaderT<Env, M, A> ma, Ask<Env, A> mb) Source #

operator | (Ask<Env, A> ma, ReaderT<Env, M, A> mb) Source #

operator | (ReaderT<Env, M, A> ma, IO<A> mb) Source #

operator | (IO<A> ma, ReaderT<Env, M, A> mb) Source #

class ReaderExt Source #

Reader monad extensions

Methods

method ReaderT<Env, M, A> As <Env, M, A> (this K<ReaderT<Env, M>, A> ma) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> Flatten <Env, M, A> (this ReaderT<Env, M, ReaderT<Env, M, A>> mma) Source #

where M : Monad<M>, SemiAlternative<M>

Monadic join

method ReaderT<Env, M, C> SelectMany <Env, M, A, B, C> ( this K<M, A> ma, Func<A, K<ReaderT<Env, M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

method ReaderT<Env, M, C> SelectMany <Env, M, A, B, C> ( this K<M, A> ma, Func<A, ReaderT<Env, M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

ReaderT

class ReaderT <Env> Source #

MonadReaderT trait implementation for ReaderT

Parameters

type Env

Reader environment type

type M

Given monad trait

Methods

method ReaderT<Env, M, A> lift <M, A> (K<M, A> ma) Source #

where M : Monad<M>, SemiAlternative<M>

class ReaderT <Env, M> Source #

MonadReaderT trait implementation for ReaderT

Parameters

type Env

Reader environment type

type M

Given monad trait

Methods

method ReaderT<Env, M, A> Pure <A> (A value) Source #

method ReaderT<Env, M, A> liftIO <A> (IO<A> effect) Source #

Lifts a given monad into the transformer

Parameters

param effect

Monad to lift

returns

ReaderT

class ReaderT Source #

MonadReaderT trait implementation for ReaderT

Parameters

type Env

Reader environment type

type M

Given monad trait

Methods

method ReaderT<Env, M, A> combine <Env, M, A> ( ReaderT<Env, M, A> ma, ReaderT<Env, M, A> mb) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, B> bind <Env, M, A, B> (ReaderT<Env, M, A> ma, Func<A, ReaderT<Env, M, B>> f) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, B> map <Env, M, A, B> (Func<A, B> f, ReaderT<Env, M, A> ma) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> Pure <Env, M, A> (A value) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, B> apply <Env, M, A, B> (ReaderT<Env, M, Func<A, B>> mf, ReaderT<Env, M, A> ma) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, B> action <Env, M, A, B> (ReaderT<Env, M, A> ma, ReaderT<Env, M, B> mb) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> lift <Env, M, A> (K<M, A> ma) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> liftIO <Env, M, A> (IO<A> effect) Source #

where M : Monad<M>, SemiAlternative<M>

Lifts a given monad into the transformer

Parameters

param effect

Monad to lift

returns

ReaderT

method ReaderT<Env, M, Env> ask <M, Env> () Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> asks <M, A, Env> (Func<Env, A> f) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> asksM <M, Env, A> (Func<Env, K<M, A>> f) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, A> local <Env, M, A> (Func<Env, Env> f, ReaderT<Env, M, A> ma) Source #

where M : Monad<M>, SemiAlternative<M>

class ReaderT <Env, M> Source #

where M : Monad<M>, SemiAlternative<M>

MonadReaderT trait implementation for ReaderT

Parameters

type Env

Reader environment type

type M

Given monad trait